{include file="index/header" /}
<link rel="stylesheet" type="text/css" href="__PUBLIC__css/jedate.css">
<script type="text/javascript" src="__PUBLIC__js/jquery.jedate.min.js"></script>
<style type="text/css">
	.inputs{display: inline-block;border: solid 1px #ddd;border-radius: 4px;margin: 0 2px;width: 58px;height: 36px;}
	.border-main{padding: 10px 5px;}
</style>
<body>
	<div class="panel admin-panel">
		<div class="panel-head"><strong class="icon-reorder"> 内容列表</strong></div>
		<table class="table table-hover text-center">
			<tr>
				<th>序号</th>
				<th>昵称</th>
				<th>联系方式</th>
				<th>会员身份</th>
				<th>申请时间</th>
				<th>申请集数</th>
				<th>最后编辑</th>
				<th>操作</th>
			</tr>
			{foreach $data as $key=>$v}
			<tr>
				<td>{$key+1}</td>
				<td>{$v.know_nickname}</td>
				<td>{$v.know_phone|disposeInfor=###,$v.know_email}</td>
				<td>{$v.know_user_id|returnIdentity=###}</td>
				<td>{$v.time|date='Y-m-d H:i:s',###}</td>
				<td><input type="number" value="{$v.amount}" class="inputs input_amount" placeholder="集数"></td>
				<td>{if $v.updated_admin_id}{$v.updated_admin_id|returnAdminName=###}<br/>{$v.updated_time|date='Y-m-d H:i:s',###}{/if}</td>
				<td><div class="button-group"> 
					<a class="button border-main" href="javascript:;" onclick="changeCount(this,{$v.status},{$v.id})"><span class="icon-edit"></span> 修改</a> 
					{switch name="$v.status" }
					{case value="0"}
						<a class="button border-main" href="javascript:;" onclick="changeCount(this,1,{$v.id})"><span class="icon-edit"></span> 同意</a> 
						<a class="button border-main" href="javascript:;" onclick="changeCount(this,2,{$v.id})"><span class="icon-edit"></span> 拒绝</a>{/case}
					{case value="1"}
						<a class="button border-main" href="javascript:;" onclick="changeCount(this,2,{$v.id})"><span class="icon-edit"></span> 拒绝</a>{/case}
					{case value="2"}
						<a class="button border-main" href="javascript:;" onclick="changeCount(this,1,{$v.id})"><span class="icon-edit"></span> 同意</a> {/case}
					{/switch}
				</div></td>
			</tr>
			{/foreach}
			<tr><td colspan="8">{$data->render()}</td></tr>
		</table>
	</div>
	<script type="text/javascript">
		function changeCount(ts,status,id){
			var amount = $(ts).parent().parent().parent().find('.input_amount').val();
			$.ajax({
				url:'/admin/user/ajax_count',
				data:{'id':id,'status':status,'amount':amount},
				success:function(){
					history.go(0);
				}
			})
		}
	</script>
</body></html>